﻿#include<iostream>
#include<string>
using namespace std;
const int cnumber = 2;
class Course;
class Score;

class Student
{
	int sno;
	string sname, sgender, sgrade;

public:
	Student() {}
	Student(int no, string name, string gender, string grade) :sno(no), sname(name), sgender(gender), sgrade(grade) {}
	void student_show();
	void course_show(Course course);
	void score_show(Score score);

};
class Course
{
public:
	Course() {}
	string cno, cname;
	Course(string no, string name) :cno(no), cname(name) {}
	friend void Student::course_show(Course course);
};
class Score
{
private:
	int sscore;
public:
	Score() {}
	Score(int s) :sscore(s) {}
	friend void Student::score_show(Score score);
};


void Student::course_show(Course course)
{
	cout << course.cno << "  " << course.cname << "  ";
}

void Student::score_show(Score score)
{
	cout << score.sscore << endl;
}

void Student::student_show()
{
	cout << sno << "  " << sname << "  " << sgender << "  " << sgrade << "  ";
}
int main()
{
	Student  st[cnumber];	Course  cs[cnumber];	Score  ss[cnumber];
	char flag = 'Y';
	while (toupper(flag) == 'Y')
	{
		cout << "请输入" << cnumber << "个课程及其分数信息（例如：2016116101 张三 男 计科161 COST3114 C++ 90）:" << endl;
		int i, msno, mscore;
		string msname, mgender, mgrade, mcno, mcname;
		for (i = 0; i < cnumber; i++)
		{
			cin >> msno >> msname >> mgender >> mgrade >> mcno >> mcname >> mscore;
			Course tcs(mcno, mcname);
			cs[i] = tcs;
			Score tss(mscore);
			ss[i] = tss;
			Student tst(msno, msname, mgender, mgrade);
			st[i] = tst;
		}
		cout << "学生课程成绩信息如下:" << endl;
		for (i = 0; i < cnumber; i++)
		{
			st[i].student_show();
			st[i].course_show(cs[i]);
			st[i].score_show(ss[i]);
		}
		cout << "----------------------------------------------------------------------" << endl;
		cout << "继续输入课程成绩吗?(Y/N)";
		cin >> flag;
	}
}
